package com.ttg.controller;

//~--- non-JDK imports --------------------------------------------------------

import com.ttg.config.Properties;
import com.ttg.data.InitGatewayReqData;
import com.ttg.pojo.OpenAccountReqDTO;
import com.ttg.utils.HttpKit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

//~--- classes ----------------------------------------------------------------

/**
 * Class GwOpenAccountDemoController
 * Description 说明：网关开户接口DEMO
 * Create 2016-08-09 10:07:00
 * @author Ardy
 */
@Controller
@RequestMapping
public class GwOpenAccountDemoController {

    /**
     * Field LOGGER
     * Description
     */
    private static final Logger LOGGER = LoggerFactory.getLogger(GwOpenAccountDemoController.class);

    /**
     * Method testOpenAccountDemo
     * Description 说明：开户接口准备
     *
     * @return 返回值说明：
     */
    @RequestMapping("/open_account")
    public ModelAndView testOpenAccountDemo() {
        ModelAndView modelAndView = new ModelAndView();

        modelAndView.setViewName("req/open_account_demo");

        OpenAccountReqDTO openAccountReqDTO = InitGatewayReqData.initOpenAccountReq();
LOGGER.debug("开户请求参数：{},参与签名串：{}",openAccountReqDTO, HttpKit.httpGwParam2SignStr(openAccountReqDTO.getAllParameters()));
        modelAndView.addObject("openAccount", openAccountReqDTO);

        String url = Properties.URL.getString("GATEWAY_BASE_SCHEME") + Properties.URL.getString("OPEN_ACCOUNT_URL");

        LOGGER.debug("请求地址：{}", url);
        modelAndView.addObject("url", url);

        return modelAndView;
    }
}


//~ Formatted by Jindent --- http://www.jindent.com
